using UnityEngine;
namespace CGF
{
    public partial class PanelPhotoView : UIComponentBase, IAwake<UILayer, bool>, IDestroy
    {
        public static void Open(Texture texture)
        {
            UIManagerComponent.instance.OpenUI<PanelPhotoView>(UILayer.Normal, RootComponent.instance, true).SetTexture(texture);
        }

        public static void Close()
        {
            UIManagerComponent.instance.CloseUI<PanelPhotoView>();
        }

        public async void Awake(UILayer layer, bool isFloat)
        {
            await SpawnPrefab("Prefabs/GameUI/PanelPhotoView", layer, isFloat);
			BindProperties(transform);
            
            BtnClose.SetClick(Close);
        }

        public void SetTexture(Texture texture)
        {
            Photo.texture = texture;
            ScaleIn(Photo.transform, 0.9f);
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
        }

    }
}
